import { createApp } from 'vue'
import i18n from '@/i18n'
import App from './App.vue'
import router from './router'
import store from './store'
import installElementIcon from './plugins/element'
import installDirective from '@/directives'

// 如果使用 unplugin-element-plus 并且只使用组件 API，你需要手动导入样式。
// https://element-plus.gitee.io/zh-CN/guide/quickstart.html#%E6%89%8B%E5%8A%A8%E5%AF%BC%E5%85%A5
<% if (data.importMethod === 'needed') { %>
import 'element-plus/es/components/message/style/css'
import 'element-plus/es/components/message-box/style/css'
import 'element-plus/es/components/loading/style/css'
<% } else { %>
import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'<% } %>
// 导入全局样式
import './styles/index.scss'
// 导入权限控制模块
import './permission'
import './middleWare'
const app = createApp(App)
// installElementPlus(app)
installDirective(app)
installElementIcon(app)

// 屏蔽错误信息
// app.config.errorHandler = () => null
// 屏蔽警告信息
app.config.warnHandler = () => null

app
  .use(store)
  .use(router)
  .use(i18n)<% if (data.importMethod === 'all') { %>
  .use(ElementPlus, {
    locale: zhCn
  })<% } %>
  .mount('#app')
